package ar.edu.sccs.dao;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import ar.edu.sccs.entities.Case;
import ar.edu.sccs.entities.Dimension;
import ar.edu.sccs.util.Constants;

public class CaseDTO {

	private Integer caseId;
	private String scmUrl;
	private Integer calificationId;

	private String projectId;
	private String ontologyId;

	private String classType;
	private String className;
	private String classPackage;
	private String classImplements;
	private String classExtend;
	private Boolean classIsPublic;
	private Boolean classIsProtected;
	private Boolean classIsPrivate;
	private Boolean classIsFinal;
	private Boolean classIsStrictfp;
	private Boolean classIsAbstract;
	private String methodName;
	private String methodReturn;
	private String methodParams;
	private String methodExceptions;
	private Boolean methodIsPublic;
	private Boolean methodIsProtected;
	private Boolean methodIsPrivate;
	private Boolean methodIsAbstract;
	private Boolean methodIsFinal;
	private Boolean methodIsStrictfp;
	private Boolean methodIsNative;
	private Boolean methodIsStatic;
	private Boolean methodIsSynchronized;

	@Override
	public String toString() {
		return ReflectionToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
	}

	/**
	 * 
	 */
	public CaseDTO() {
		super();
	}

	public CaseDTO(Case newCase) {
		super();
		Dimension dim;

		scmUrl = newCase.getScmUrl();
		calificationId = newCase.getCalification();

		if ( (dim = newCase.getDimension(Constants.Dimension.Class.TYPE)) != null )
			this.classType = dim.getStringValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Class.NAME)) != null )
			this.className = dim.getStringValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Class.PACKAGE)) != null )
			this.classPackage = dim.getStringValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Class.IMPLEMENTS)) != null )
			this.classImplements = dim.getStringValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Class.EXTEND)) != null )
			this.classExtend = dim.getStringValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Class.PUBLIC)) != null )
			this.classIsPublic = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Class.PROTECTED)) != null )
			this.classIsProtected = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Class.PRIVATE)) != null )
			this.classIsPrivate = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Class.FINAL)) != null )
			this.classIsFinal = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Class.STRICTFP)) != null )
			this.classIsStrictfp = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Class.ABSTRACT)) != null )
			this.classIsAbstract = dim.getBooleanValue();

		if ( (dim = newCase.getDimension(Constants.Dimension.Method.NAME)) != null ) {
			this.methodName = dim.getStringValue();
		} else {
			if ( (dim = newCase.getDimension(Constants.Dimension.Method.ACTION)) != null )
				this.methodName = dim.getStringValue();
			if ( (dim = newCase.getDimension(Constants.Dimension.Method.OBJECT)) != null )
				this.methodName += "%" + dim.getStringValue();
		}

		if ( (dim = newCase.getDimension(Constants.Dimension.Method.RETURN)) != null )
			this.methodReturn = dim.getStringValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.PARAMS)) != null )
			this.methodParams = dim.getStringValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.EXCEPTIONS)) != null )
			this.methodExceptions = dim.getStringValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.PUBLIC)) != null )
			this.methodIsPublic = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.PROTECTED)) != null )
			this.methodIsProtected = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.PRIVATE)) != null )
			this.methodIsPrivate = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.FINAL)) != null )
			this.methodIsFinal = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.STRICTFP)) != null )
			this.methodIsStrictfp = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.ABSTRACT)) != null )
			this.methodIsAbstract = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.NATIVE)) != null )
			this.methodIsNative = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.STATIC)) != null )
			this.methodIsStatic = dim.getBooleanValue();
		if ( (dim = newCase.getDimension(Constants.Dimension.Method.SYNCRONIZED)) != null )
			this.methodIsSynchronized = dim.getBooleanValue();
	}

	/**
	 * @return the caseId
	 */
	public Integer getCaseId() {
		return caseId;
	}

	/**
	 * @param caseId
	 *            the caseId to set
	 */
	public void setCaseId(Integer caseId) {
		this.caseId = caseId;
	}

	/**
	 * @return the scmUrl
	 */
	public String getScmUrl() {
		return scmUrl;
	}

	/**
	 * @param scmUrl
	 *            the scmUrl to set
	 */
	public void setScmUrl(String scmUrl) {
		this.scmUrl = scmUrl;
	}

	/**
	 * @return the calificationId
	 */
	public Integer getCalificationId() {
		return calificationId;
	}

	/**
	 * @param calificationId
	 *            the calificationId to set
	 */
	public void setCalificationId(Integer calificationId) {
		this.calificationId = calificationId;
	}

	/**
	 * @return the projectId
	 */
	public String getProjectId() {
		return projectId;
	}

	/**
	 * @param projectId
	 *            the projectId to set
	 */
	public void setProjectId(String projectId) {
		this.projectId = projectId;
	}

	/**
	 * @return the ontologyId
	 */
	public String getOntologyId() {
		return ontologyId;
	}

	/**
	 * @param ontologyId
	 *            the ontologyId to set
	 */
	public void setOntologyId(String ontologyId) {
		this.ontologyId = ontologyId;
	}

	/**
	 * @return the classType
	 */
	public String getClassType() {
		return classType;
	}

	/**
	 * @param classType
	 *            the classType to set
	 */
	public void setClassType(String classType) {
		this.classType = classType;
	}

	/**
	 * @return the className
	 */
	public String getClassName() {
		return className;
	}

	/**
	 * @param className
	 *            the className to set
	 */
	public void setClassName(String className) {
		this.className = className;
	}

	/**
	 * @return the classPackage
	 */
	public String getClassPackage() {
		return classPackage;
	}

	/**
	 * @param classPackage
	 *            the classPackage to set
	 */
	public void setClassPackage(String classPackage) {
		this.classPackage = classPackage;
	}

	/**
	 * @return the classImplements
	 */
	public String getClassImplements() {
		return classImplements;
	}

	/**
	 * @param classImplements
	 *            the classImplements to set
	 */
	public void setClassImplements(String classImplements) {
		this.classImplements = classImplements;
	}

	/**
	 * @return the classExtend
	 */
	public String getClassExtend() {
		return classExtend;
	}

	/**
	 * @param classExtend
	 *            the classExtend to set
	 */
	public void setClassExtend(String classExtend) {
		this.classExtend = classExtend;
	}

	/**
	 * @return the classIsPublic
	 */
	public Boolean getClassIsPublic() {
		return classIsPublic;
	}

	/**
	 * @param classIsPublic
	 *            the classIsPublic to set
	 */
	public void setClassIsPublic(Boolean classIsPublic) {
		this.classIsPublic = classIsPublic;
	}

	/**
	 * @return the classIsProtected
	 */
	public Boolean getClassIsProtected() {
		return classIsProtected;
	}

	/**
	 * @param classIsProtected
	 *            the classIsProtected to set
	 */
	public void setClassIsProtected(Boolean classIsProtected) {
		this.classIsProtected = classIsProtected;
	}

	/**
	 * @return the classIsPrivate
	 */
	public Boolean getClassIsPrivate() {
		return classIsPrivate;
	}

	/**
	 * @param classIsPrivate
	 *            the classIsPrivate to set
	 */
	public void setClassIsPrivate(Boolean classIsPrivate) {
		this.classIsPrivate = classIsPrivate;
	}

	/**
	 * @return the classIsFinal
	 */
	public Boolean getClassIsFinal() {
		return classIsFinal;
	}

	/**
	 * @param classIsFinal
	 *            the classIsFinal to set
	 */
	public void setClassIsFinal(Boolean classIsFinal) {
		this.classIsFinal = classIsFinal;
	}

	/**
	 * @return the classIsStrictfp
	 */
	public Boolean getClassIsStrictfp() {
		return classIsStrictfp;
	}

	/**
	 * @param classIsStrictfp
	 *            the classIsStrictfp to set
	 */
	public void setClassIsStrictfp(Boolean classIsStrictfp) {
		this.classIsStrictfp = classIsStrictfp;
	}

	/**
	 * @return the classIsAbstract
	 */
	public Boolean getClassIsAbstract() {
		return classIsAbstract;
	}

	/**
	 * @param classIsAbstract
	 *            the classIsAbstract to set
	 */
	public void setClassIsAbstract(Boolean classIsAbstract) {
		this.classIsAbstract = classIsAbstract;
	}

	/**
	 * @return the methodName
	 */
	public String getMethodName() {
		return methodName;
	}

	/**
	 * @param methodName
	 *            the methodName to set
	 */
	public void setMethodName(String methodName) {
		this.methodName = methodName;
	}

	/**
	 * @return the methodReturn
	 */
	public String getMethodReturn() {
		return methodReturn;
	}

	/**
	 * @param methodReturn
	 *            the methodReturn to set
	 */
	public void setMethodReturn(String methodReturn) {
		this.methodReturn = methodReturn;
	}

	/**
	 * @return the methodParams
	 */
	public String getMethodParams() {
		return methodParams;
	}

	/**
	 * @param methodParams
	 *            the methodParams to set
	 */
	public void setMethodParams(String methodParams) {
		this.methodParams = methodParams;
	}

	/**
	 * @return the methodExceptions
	 */
	public String getMethodExceptions() {
		return methodExceptions;
	}

	/**
	 * @param methodExceptions
	 *            the methodExceptions to set
	 */
	public void setMethodExceptions(String methodExceptions) {
		this.methodExceptions = methodExceptions;
	}

	/**
	 * @return the methodIsPublic
	 */
	public Boolean getMethodIsPublic() {
		return methodIsPublic;
	}

	/**
	 * @param methodIsPublic
	 *            the methodIsPublic to set
	 */
	public void setMethodIsPublic(Boolean methodIsPublic) {
		this.methodIsPublic = methodIsPublic;
	}

	/**
	 * @return the methodIsProtected
	 */
	public Boolean getMethodIsProtected() {
		return methodIsProtected;
	}

	/**
	 * @param methodIsProtected
	 *            the methodIsProtected to set
	 */
	public void setMethodIsProtected(Boolean methodIsProtected) {
		this.methodIsProtected = methodIsProtected;
	}

	/**
	 * @return the methodIsPrivate
	 */
	public Boolean getMethodIsPrivate() {
		return methodIsPrivate;
	}

	/**
	 * @param methodIsPrivate
	 *            the methodIsPrivate to set
	 */
	public void setMethodIsPrivate(Boolean methodIsPrivate) {
		this.methodIsPrivate = methodIsPrivate;
	}

	/**
	 * @return the methodIsAbstract
	 */
	public Boolean getMethodIsAbstract() {
		return methodIsAbstract;
	}

	/**
	 * @param methodIsAbstract
	 *            the methodIsAbstract to set
	 */
	public void setMethodIsAbstract(Boolean methodIsAbstract) {
		this.methodIsAbstract = methodIsAbstract;
	}

	/**
	 * @return the methodIsFinal
	 */
	public Boolean getMethodIsFinal() {
		return methodIsFinal;
	}

	/**
	 * @param methodIsFinal
	 *            the methodIsFinal to set
	 */
	public void setMethodIsFinal(Boolean methodIsFinal) {
		this.methodIsFinal = methodIsFinal;
	}

	/**
	 * @return the methodIsStrictfp
	 */
	public Boolean getMethodIsStrictfp() {
		return methodIsStrictfp;
	}

	/**
	 * @param methodIsStrictfp
	 *            the methodIsStrictfp to set
	 */
	public void setMethodIsStrictfp(Boolean methodIsStrictfp) {
		this.methodIsStrictfp = methodIsStrictfp;
	}

	/**
	 * @return the methodIsNative
	 */
	public Boolean getMethodIsNative() {
		return methodIsNative;
	}

	/**
	 * @param methodIsNative
	 *            the methodIsNative to set
	 */
	public void setMethodIsNative(Boolean methodIsNative) {
		this.methodIsNative = methodIsNative;
	}

	/**
	 * @return the methodIsStatic
	 */
	public Boolean getMethodIsStatic() {
		return methodIsStatic;
	}

	/**
	 * @param methodIsStatic
	 *            the methodIsStatic to set
	 */
	public void setMethodIsStatic(Boolean methodIsStatic) {
		this.methodIsStatic = methodIsStatic;
	}

	/**
	 * @return the methodIsSynchronized
	 */
	public Boolean getMethodIsSynchronized() {
		return methodIsSynchronized;
	}

	/**
	 * @param methodIsSynchronized
	 *            the methodIsSynchronized to set
	 */
	public void setMethodIsSynchronized(Boolean methodIsSynchronized) {
		this.methodIsSynchronized = methodIsSynchronized;
	}
}
